import {Panel} from 'comps/common';
import {Tag} from 'antd';
import * as React from 'react';

class ServiceTag extends React.Component {

  onClose() {
    const props = this.props;

    const newTags = [];
    const {tags= []} = props.service;
    tags.map(function (tag) {
      if (props.children !== tag)
        newTags.push(tag);
    });
    props.onRemoveServiceTag(props.service.id, newTags.join(','));
  }

  render() {
    return (
      <Tag closable onClose={::this.onClose} color="blue">{this.props.children}</Tag>
    );
  }
}

export default ServiceTag;
